package com.sx.interceptor;

import com.sx.service.system.IAdminService;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author AdinZ
 * @date 2020/11/13 16:11
 */
@Configuration
public class WebSafeConfig implements WebMvcConfigurer {
    @Resource private IAdminService adminService;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TokenHandler(adminService))
                .addPathPatterns("/**")
                .excludePathPatterns("/admin/login","/admin/get_info");
    }
}
